﻿@model PhoneBilling.Models.Report3ResultModel
@{
    ViewBag.Title = "分机话务统计";
    Layout = "~/Views/Shared/_Layout.cshtml"; 
}
<script type="text/javascript">
    $(document).ready(function () {
        $("#btnReturn").ligerButton(
        {
            click: function () {
                history.go(-1); //后退1页  
            }
        });
        $("#btnImport").ligerButton(
        {
            click: function () {
                $("form").submit();
            }
        });
    });
    
</script>
@using (Html.BeginForm("Report3", "Statistics"))
{
    @Html.HiddenFor(m => m.SelectItem)
    @Html.HiddenFor(m => m.起始时间)
    @Html.HiddenFor(m => m.起始时间Time)
    @Html.HiddenFor(m => m.终止时间)
    @Html.HiddenFor(m => m.终止时间Time)
    @Html.HiddenFor(m => m.所有话类)
    @Html.HiddenFor(m => m.话类)
    @Html.Hidden("IsExport", true)
    <input type="button" id="btnReturn" value="返回" />
    <input type="button" id="btnImport" value="导出Excel" />
    <p />
    <div>@Html.Raw(Model.Content)</div>
    <p />
    @*<div>
        @{
    var grid = new WebGrid(source: Model.List, canPage: false);
        }
        @grid.GetHtml(
            alternatingRowStyle: "bg",
            columns: grid.Columns
            (
                  grid.Column("部门", "部门"),
                  grid.Column("分组", "分组"),
                  grid.Column("分机号码", "分机号码"),
                  grid.Column("话单总金额", "总金额"),
                    grid.Column("内线金额", "内线金额"),
                    grid.Column("市话金额", "市话金额"),
                    grid.Column("郊县金额", "郊县金额"),
                    grid.Column("IP金额", "IP金额"),
                    grid.Column("信息金额", "信息金额"),

                    grid.Column("专线金额", "专线金额"),
                    grid.Column("国内金额", "国内金额"),

                    grid.Column("国际金额", "国际金额"),
                    grid.Column("其他金额", "其他金额")
            )
        )
    </div>*@
}
@{
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.AppendLine(string.Format("var data={{Total:{0},",Model.List.Count));
    sb.AppendLine("Rows:[");
    for(int i =0;i < Model.List.Count;i++)
    {
        var item = Model.List[i];
        if(i == 0)
        {
            sb.Append("{");
        }
        else
        {
            sb.Append(",{");
        }
        sb.Append(string.Format("部门:'{0}',", item.部门));
        sb.Append(string.Format("分组:'{0}',",item.分组));
        sb.Append(string.Format("分机号码:'{0}',",item.分机号码));
        sb.Append(string.Format("话单总金额:'{0}',", item.话单总金额));
        sb.Append(string.Format("内线金额:'{0}',", item.内线金额));
        sb.Append(string.Format("市话金额:'{0}',", item.市话金额));
        sb.Append(string.Format("郊县金额:'{0}',", item.郊县金额));
        sb.Append(string.Format("IP金额:'{0}',", item.IP金额));
        sb.Append(string.Format("信息金额:'{0}',", item.信息金额));
        sb.Append(string.Format("专线金额:'{0}',", item.专线金额));
        sb.Append(string.Format("国内金额:'{0}',", item.国内金额));
        sb.Append(string.Format("国际金额:'{0}',", item.国际金额));
        sb.Append(string.Format("其他金额:'{0}'", item.其他金额));
        sb.Append("}");
    }
    sb.AppendLine("]};");
    string data = sb.ToString();
}
<script type="text/javascript">
    @Html.Raw(data)
    var grid;
    $(function () {

        grid = $("#maingrid").ligerGrid({
            columns: [
                { display: '部门', name: '部门',width:80},
                { display: '分组', name: '分组',width:80},
                { display: '分机号码', name: '分机号码',width:80},
                { display: '总金额', name: '话单总金额',width:140,totalSummary:                    {render: function (suminf, column, cell){                            return '<div>总金额:' + suminf.max + '</div>';                        }}},
                { display: '内线金额', name: '内线金额',width:80},
                { display: '市话金额', name: '市话金额',width:80},
                { display: '郊县金额', name: '郊县金额',width:80},
                { display: 'IP金额', name: 'IP金额',width:80},
                { display: '信息金额', name: '信息金额',width:80},
                { display: '专线金额', name: '专线金额',width:80},
                { display: '国内金额', name: '国内金额',width:80},
                { display: '国际金额', name: '国际金额',width:80},
                { display: '其他金额', name: '其他金额',width:80}],
                isScroll: false, data: data,pageSize:30,alternatingRow:true
        }
        );resetGridHeight(grid);
        $(window).resize(function () {
                resetGridHeight(grid);
            });
    });</script>
    <div id="maingrid"></div>